<!-- 
	单据item
 -->
<template>
	<view class="u-bill-item f-bc-whilte f-mb8">
		<view class="g-item-header f-frowspcen">
			<view class="f-frowceny">
				<image src="../../static/icon/order/icon_order_tag.png" mode="aspectFit" class="order-icon f-mr10"></image>
				<text class="f-fz15 f-fc-primary f-mr8 f-fw650">{{ typeName }}</text>
				<text class="f-fz13 f-fc-primary">PO20200426005</text>
			</view>
			<text class="f-fz13 f-fc-grey">2020-04-12</text>
		</view>
		<view class="g-content f-fz13">
			<view class="f-frowceny f-mt8">
				<text class="key f-fs0 f-fc-grey f-mr10">车型名称</text>
				<text class="f-f1 f-fc-primary f-toh">别克 GL8 2018款 ES 28T 豪华型 国VI-36.99万</text>
			</view>
			<view class="f-frow f-fwrap f-mt10">
				<view class="car-msg f-mb8">
					<text class="key f-fc-grey f-mr10">数量</text>
					<text class="f-f1 f-fc-primary">20</text>
				</view>
				<view class="car-msg f-mb8">
					<text class="key f-fc-grey f-mr10">指导价</text>
					<text class="f-fc-primary">3000.00元</text>
				</view>
				<view class="car-msg">
					<text class="key f-fc-grey f-mr10">采购人</text>
					<text class="f-f1 f-fc-primary">王渝湛</text>
				</view>
				<view class="car-msg">
					<text class="key f-fc-grey f-mr10">外饰/内饰</text>
					<text class="f-fc-primary">黑色/白色</text>
				</view>
			</view>
		</view>
		<view class="g-bill-bot f-frowspcen">
			<text class="f-fz13 f-fc-grey">2020-04-19 07:23:12</text>
			<button class="u-order-btn" @tap="toSelectInput" v-if="input">入库</button>
			<button class="u-order-btn" @tap="toSelectOutput" v-if="output">出库</button>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		/**
		 * purchase		采购
		 * sale			销售
		 * */ 
		type: {
			type: String,
			default: ''
		},
		input: {
			type: Boolean,
			default: false
		},
		output: {
			type: Boolean,
			default: false
		},
	},
	data() {
		return {
			
		};
	}, 
	created() {
		/**
		 * 如果type 未传时，请自行判断
		 * */
		const that = this;
		console.log('input---------------');
		console.log(that.input);
	},
	computed: {
		typeName() {
			const TYPE = {
				purchase: '采购单',
				sale: '销售单',
			};
			return TYPE[this.type];
		}
	},
	methods: {
		/**
		 * 选择入库车
		 * */ 
		toSelectInput() {
			uni.navigateTo({
				url: '/pages/input/submit'
			})
		},
		/**
		 * 选择出库车
		 * */ 
		toSelectOutput() {
			uni.navigateTo({
				url: '/pages/output/matchCar'
			})
		}
	}
};
</script>

<style lang="scss" scoped>
.u-bill-item {
	.g-content {
		padding: 0 30rpx;
		.car-msg {
			width: 50%;
			.key {
				display: inline-block;
				width: 116rpx;
			}
		}
	}
	.g-bill-bot {
		padding: 24rpx 30rpx;
	}
}
</style>
